package com.slfx.idgen.server.controller;

import com.slfx.idgen.server.snowflake.SnowflakeIdWorker;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author zengqingfa
 * @className IdgenServerController
 * @description
 * @create 2022/10/2 11:16
 */
@RestController
@RequestMapping("/snowflakeIdWorker")
public class IdgenServerController {

    @Resource
    private SnowflakeIdWorker snowflakeIdWorker;

    @GetMapping("/nextId")
    public Long nextId() {
        long nextId = snowflakeIdWorker.nextId();
        return nextId;
    }

}